package com.xiaoxu.intranetweb.mybatisplusSzappdb.vo.Constructor;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.entity.SysUser;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.entity.TApproveInfoDetail;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.service.ISysUserService;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.vo.GetApproveInfoDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TApproveInfoDetail2GetApproveInfoDetailVo {
    @Autowired
    private ISysUserService iSysUserService;
    public GetApproveInfoDetailVo getApproveInfoDetailVo(TApproveInfoDetail tApproveInfoDetail){
        GetApproveInfoDetailVo getApproveInfoDetailVo = new GetApproveInfoDetailVo();
        getApproveInfoDetailVo.setId(tApproveInfoDetail.getId());
        getApproveInfoDetailVo.setApproveInfoId(tApproveInfoDetail.getApproveInfoId());
        getApproveInfoDetailVo.setApproveUserId(tApproveInfoDetail.getApproveUserId());
        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",tApproveInfoDetail.getApproveUserId());
        SysUser sysUser = iSysUserService.getOne(queryWrapper);
        getApproveInfoDetailVo.setApproveUserName(sysUser.getTrueName());
        getApproveInfoDetailVo.setApproveTier(tApproveInfoDetail.getApproveTier());
        getApproveInfoDetailVo.setCreateTime(tApproveInfoDetail.getCreateTime());
        getApproveInfoDetailVo.setApproveState(tApproveInfoDetail.getApproveState());
        getApproveInfoDetailVo.setDelFlag(tApproveInfoDetail.getDelFlag());
        getApproveInfoDetailVo.setApproveRemark(tApproveInfoDetail.getApproveRemark());
        return getApproveInfoDetailVo;
    }

}
